﻿#pragma once
#include "ZuiLib.h"
#include "LRefObject.h"

namespace ZuiLib {

class LComboxItem :public LRefObject<ZComboxItem>
{
public:
	BEGIN_MAP_FUNC(LComboxItem)

	END_MAP_FUNC
};




class LCombox :public LRefObject<ZCombox>
{
public:

	int setEnabled(LuaFuncState& L)
	{
		pThis->SetEnabled(L.arg(0).toBool());
		return 0;
	}

	int getNormalImage(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetNormalImage());
	}

	int setNormalImage(LuaFuncState& L)
	{
		pThis->SetNormalImage(L.arg(0).toString());
		return 0;
	}

	int getHotImage(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetHotImage());
	}

	int setHotImage(LuaFuncState& L)
	{
		pThis->SetHotImage(L.arg(0).toString());
		return 0;
	}

	int getPushedImage(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetPushedImage());
	}

	int setPushedImage(LuaFuncState& L)
	{
		pThis->SetPushedImage(L.arg(0).toString());
		return 0;
	}

	int getFocusedImage(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetFocusedImage());
	}

	int setFocusedImage(LuaFuncState& L)
	{
		pThis->SetFocusedImage(L.arg(0).toString());
		return 0;
	}

	int getDisabledImage(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetDisabledImage());
	}

	int setDisabledImage(LuaFuncState& L)
	{
		pThis->SetDisabledImage(L.arg(0).toString());
		return 0;
	}

	int getHotTextColor(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetHotTextColor());
	}

	int setHotTextColor(LuaFuncState& L)
	{
		pThis->SetHotTextColor(toColor(L.arg(0)));
		return 0;
	}

	int getPushedTextColor(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetPushedTextColor());
	}

	int setPushedTextColor(LuaFuncState& L)
	{
		pThis->SetPushedTextColor(toColor(L.arg(0)));
		return 0;
	}


	int getFocusedTextColor(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetFocusedTextColor());
	}

	int setFocusedTextColor(LuaFuncState& L)
	{
		pThis->SetFocusedTextColor(toColor(L.arg(0)));
		return 0;
	}

	int getItemAt(LuaFuncState& L)
	{
		return L.lreturn(LuaClass<ZControl>::cToLua(&L, pThis->GetItemAt(L.arg(0).toInt())));
	}

	int getItemIndex(LuaFuncState& L)
	{
		ZControl* ctrl = LuaClass<ZControl>::luaToC(L.arg(0));
		return L.lreturn(pThis->GetItemIndex(ctrl));
	}

	int setItemIndex(LuaFuncState& L)
	{
		ZControl* ctrl = LuaClass<ZControl>::luaToC(L.arg(0));
		return L.lreturn(pThis->SetItemIndex(ctrl, L.arg(1).toInt()));
	}

	int getCount(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetCount());
	}

	int add(LuaFuncState& L)
	{
		ZControl* ctrl = LuaClass<ZControl>::luaToC(L.arg(0));
		return L.lreturn(pThis->Add(ctrl));
	}

	int addAt(LuaFuncState& L)
	{
		ZControl* ctrl = LuaClass<ZControl>::luaToC(L.arg(0));
		return L.lreturn(pThis->AddAt(ctrl, L.arg(1).toInt()));
	}

	int remove(LuaFuncState& L)
	{
		ZControl* ctrl = LuaClass<ZControl>::luaToC(L.arg(0));
		return L.lreturn(pThis->Remove(ctrl));
	}

	int removeAt(LuaFuncState& L)
	{
		return L.lreturn(pThis->RemoveAt(L.arg(0).toInt()));
	}

	int removeAll(LuaFuncState& L)
	{
		pThis->RemoveAll();
		return 0;
	}

	int showDropList(LuaFuncState& L)
	{
		pThis->ShowDropList(L.arg(0).toBool());
		return 0;
	}

	int setSelect(LuaFuncState& L)
	{
		pThis->SetSelect(L.arg(0).toInt());
		return 0;
	}

	BEGIN_MAP_FUNC(LCombox)
	DECLARE_FUNC(setEnabled),
	DECLARE_FUNC(getNormalImage),
	DECLARE_FUNC(setNormalImage),
	DECLARE_FUNC(getHotImage),
	DECLARE_FUNC(setHotImage),
	DECLARE_FUNC(getPushedImage),
	DECLARE_FUNC(setPushedImage),
	DECLARE_FUNC(getFocusedImage),
	DECLARE_FUNC(setFocusedImage),
	DECLARE_FUNC(getDisabledImage),
	DECLARE_FUNC(setDisabledImage),
	DECLARE_FUNC(getHotTextColor),
	DECLARE_FUNC(setHotTextColor),
	DECLARE_FUNC(getPushedTextColor),
	DECLARE_FUNC(setPushedTextColor),
	DECLARE_FUNC(getFocusedTextColor),
	DECLARE_FUNC(setFocusedTextColor),
	DECLARE_FUNC(getItemAt),
	DECLARE_FUNC(getItemIndex),
	DECLARE_FUNC(setItemIndex),
	DECLARE_FUNC(getCount),
	DECLARE_FUNC(add),
	DECLARE_FUNC(addAt),
	DECLARE_FUNC(remove),
	DECLARE_FUNC(removeAt),
	DECLARE_FUNC(removeAll),
	DECLARE_FUNC(showDropList),
	DECLARE_FUNC(setSelect),
	END_MAP_FUNC
};

}//namespace
